package com.example.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.example.config.es.aspect.annotation.EsSync;
import com.example.entity.pojo.User;
import org.springframework.transaction.annotation.Transactional;

public interface UserService extends IService<User> {

    // 新增并同步到ES（指定强一致性）
    @EsSync(strategy = "strongConsistency", entityClass = User.class)
    @Transactional
    public void saveUser(User user);

    // 更新并同步到ES（默认最终一致性）
    @EsSync(entityClass = User.class)
    @Transactional
    public void updateUser(User user);

    // 删除并同步到ES
    @EsSync(entityClass = User.class)
    @Transactional
    public void deleteUser(Long id);
}
